﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteMaster.Master" AutoEventWireup="true"
    CodeBehind="Home.aspx.cs" Inherits="Logistics.WebForm3" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </cc1:ToolkitScriptManager>
    <script type="text/javascript">


        function ConfirmDelete() {

            var ret = false;
            if (confirm("Are you sure you want to delete this time period, Action can not be taken back"))
                ret = true;
            else
                ret = false;

            //alert(ret);
            return ret;

        }
    </script>
    <%--<div>
        Welcome
        <asp:LoginName ID="LoginName1" runat="server" />
        <asp:LoginStatus ID="LoginStatus1" runat="server" BackColor="#FF9999" 
            BorderStyle="Outset" onloggingout="LoginStatus1_LoggingOut" />
    </div>--%>
    <div style="text-align:left !important;">
        <asp:Label runat="server" ID="lblStore">Store:</asp:Label>
        <asp:DropDownList ID="ddl1" runat="server" ToolTip="Select Store">
        </asp:DropDownList>
        &nbsp;&nbsp;
        <asp:Label runat="server" ID="Label1">Category:</asp:Label>
        <asp:DropDownList ID="ddl2" runat="server" OnSelectedIndexChanged="ddl2_SelectedIndexChanged"
            AutoPostBack="true" ToolTip="Select Category">
            <asp:ListItem Selected="True"></asp:ListItem>
        </asp:DropDownList>
        <asp:Label runat="server" ID="lblYear">Year:</asp:Label>
        <asp:DropDownList ID="ddlYear" runat="server" ToolTip="Select Year">
        </asp:DropDownList>
        <asp:Label runat="server" ID="lblMonth">Month:</asp:Label>
        <asp:DropDownList ID="ddlMonth" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlMonth_SelectedIndexChanged"
            ToolTip="Select Month">
        </asp:DropDownList>
        <%--    <asp:Label runat="server" ID="lblType">Type:</asp:Label>
        <asp:DropDownList ID="ddlType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlMonth_SelectedIndexChanged">
        <asp:ListItem Text="General" Value="General" Selected="True"></asp:ListItem>
        <asp:ListItem Text ="Fiscal" Value="Fiscal"></asp:ListItem>
        </asp:DropDownList>--%>
        <asp:Button ID="btnSummary" runat="server" Text="Summary" OnClick="GetSummary" ValidationGroup="v1" ToolTip="Click here for summary" />
        <%-- <asp:Label runat="server" ID="Label4">Summary:</asp:Label>--%>
        <br />
        <br />
    </div>
    <div style="display:table-row; width:100%;">
        <div style="display:table-cell;width:45%;padding:10px;">
            <asp:GridView ID="GridView1" runat="server" CssClass="gv" BackColor="White" BorderColor="#CC9966"
                BorderStyle="None" BorderWidth="1px" CellPadding="4" OnSelectedIndexChanged="GridView1_SelectedIndexChanged2"
                EnableModelValidation="True" Width="420px">
                <Columns>
                    <asp:BoundField DataField="Retail_Cat1" HeaderText="Retail_Cat">
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle HorizontalAlign="Left" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Total" DataFormatString="{0:N}" HeaderText="Amount">
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle CssClass="right" HorizontalAlign="Right" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Rent" DataFormatString="{0:N}" HeaderText="Rent">
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle CssClass="right" HorizontalAlign="Right" />
                    </asp:BoundField>
                </Columns>
                <FooterStyle BackColor="White" ForeColor="#000066" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White"></HeaderStyle>
                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                <RowStyle ForeColor="#000066" />
                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                <%--<SortedAscendingCellStyle BackColor="#F1F1F1" />
      <SortedAscendingHeaderStyle BackColor="#007DBB" />
      <SortedDescendingCellStyle BackColor="#CAC9C9" />
      <SortedDescendingHeaderStyle BackColor="#00547E"/>--%>
            </asp:GridView>
        </div>
        <div style="display:table-cell;width:45%;padding:10px;">
            <asp:GridView ID="GridView2" runat="server" CssClass="gv" BackColor="White" BorderColor="#CC9966"
                BorderStyle="None" BorderWidth="1px" CellPadding="4" AutoGenerateColumns="false"
                ToolTip="Tenure and BPP values" Width="420px">
                <Columns>
                    <asp:BoundField DataField="StartDate" HeaderText="Start Date" DataFormatString="{0:d}">
                        <ItemStyle HorizontalAlign="Left" />
                    </asp:BoundField>
                    <asp:BoundField DataField="EndDate" HeaderText="End Date" DataFormatString="{0:d}">
                        <ItemStyle HorizontalAlign="Left" />
                    </asp:BoundField>
                    <asp:BoundField DataField="BPPercent" HeaderText="BPP">
                        <ItemStyle HorizontalAlign="Right" />
                    </asp:BoundField>
                </Columns>
                <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White"></HeaderStyle>
                <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                <RowStyle BackColor="White" ForeColor="#330099" />
                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
                <%--    <SortedAscendingCellStyle BackColor="#FEFCEB" />
            <SortedAscendingHeaderStyle BackColor="#AF0101" />
            <SortedDescendingCellStyle BackColor="#F6F0C0" />
            <SortedDescendingHeaderStyle BackColor="#7E0000" />--%>
            </asp:GridView>
        </div>
    </div>
    <div style="clear:both;"></div>
    <div style="display:table-row;">
    <div style="display:table-cell;width:60% !important;">
        <asp:Calendar ID="OutlookCalendar" runat="server" BackColor="White" BorderColor="#3366CC"
            BorderWidth="1px" CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana"
            Font-Size="8pt" ForeColor="#003399" OnDayRender="OutlookCalendar_DayRender" OnSelectionChanged="SelectionModeCalendar_SelectionChanged"
            Width="95%" ShowGridLines="True" ToolTip="PerdaySalesView">
            <DayHeaderStyle BackColor="#99CCCC" ForeColor="#336666" Height="1px" />
            <DayStyle Height="100px" Width="100px" VerticalAlign="Top" />
            <NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
            <OtherMonthDayStyle ForeColor="#999999" CssClass="outSpecMonth" />
            <SelectedDayStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
            <SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
            <TitleStyle BackColor="#003399" BorderColor="#3366CC" BorderWidth="1px" Font-Bold="True"
                Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
            <TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
            <WeekendDayStyle BackColor="#CCCCFF" />
        </asp:Calendar>
    </div>
        <div style="width: 40% !important; display:table-cell;">
            <asp:GridView ID="gridUserPercents" CssClass="gv" runat="server" DataKeyNames="ID" ShowFooter="true"
                BackColor="White" BorderColor="#CC9966" AutoGenerateColumns="false" BorderStyle="None"
                BorderWidth="1px" CellPadding="1" Font-Size="Smaller" OnRowCommand="gv_RowCommand"
                OnRowEditing="gv_RowEditing" OnRowCancelingEdit="gv_RowCancelingEdit" OnRowUpdating="gv_RowUpdating"
                OnRowDeleting="gv_RowDeleting" AllowPaging="true" PageSize="2" OnPageIndexChanging="gv_PageIndexChanging"
                EmptyDataText=" " EnableModelValidation="True" ToolTip="UserRate Input">
                <Columns>
                    <asp:TemplateField HeaderText="From Date">
                        <ItemTemplate>
                            <asp:Label ID="gvlblFromDate" EnableTheming="false" runat="server"><%# Eval("FromDate") != null && Eval("FromDate") is DateTime ? Convert.ToDateTime(Eval("FromDate").ToString()).ToShortDateString() : ""%></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="gvtxtFromDate" runat="server" Width="48px" Text='<%# Convert.ToDateTime(Eval("FromDate")).ToShortDateString() %>'></asp:TextBox>
                            <asp:ImageButton ID="gvimgFromDate" runat="server" ImageUrl="images/calendar.png"
                                Width="12px" ImageAlign="Bottom" />
                            <cc1:CalendarExtender ID="gvcalFromDate" runat="server" TargetControlID="gvtxtFromDate"
                                PopupButtonID="gvimgFromDate" Format="M/d/yyyy" />
                            <asp:RequiredFieldValidator ID="ReqEFDate" ControlToValidate="gvtxtFromDate" runat="server" ForeColor="Red" ErrorMessage="*" />
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtFromDate" runat="server" Width="48px" />
                            <asp:ImageButton ID="imgFromDate" runat="server" ImageUrl="images/calendar.png" Width="12px"
                                ImageAlign="Bottom" />
                            <cc1:CalendarExtender ID="calFromDate" runat="server" TargetControlID="txtFromDate"
                                PopupButtonID="imgFromDate" Format="M/d/yyyy" />
                            <asp:RequiredFieldValidator ID="ReqNFDate" ValidationGroup="v2" ControlToValidate="txtFromDate" ForeColor="Red" runat="server" ErrorMessage="*" />
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="End Date">
                        <ItemTemplate>
                            <asp:Label ID="gvlblEndDate" runat="server" EnableTheming="false"><%# Eval("ToDate") != null && Eval("ToDate") is DateTime ? Convert.ToDateTime(Eval("ToDate").ToString()).ToShortDateString() : "" %></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="gvtxtEndDate" runat="server" Width="48px" Text='<%# Convert.ToDateTime(Eval("ToDate")).ToShortDateString() %>'></asp:TextBox>
                            <asp:ImageButton ID="gvimgEndDate" runat="server" ImageUrl="images/calendar.png"
                                Width="12px" ImageAlign="Bottom" />
                            <cc1:CalendarExtender ID="gvcalEndDate" runat="server" TargetControlID="gvtxtEndDate"
                                PopupButtonID="gvimgEndDate" Format="M/d/yyyy" />
                                <asp:RequiredFieldValidator ID="ReqEEDate" ValidationGroup="v2" ControlToValidate="gvtxtEndDate" runat="server" ForeColor="Red" ErrorMessage="*" />
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtEndDate" runat="server" Width="48px" />
                            <asp:ImageButton ID="imgEndDate" runat="server" ImageUrl="images/calendar.png" ImageAlign="Bottom"
                                Width="12px" />
                            <cc1:CalendarExtender ID="calEndDate" runat="server" TargetControlID="txtEndDate"
                                PopupButtonID="imgEndDate" Format="M/d/yyyy" />
                                <asp:RequiredFieldValidator ID="ReqNEDate" ControlToValidate="txtEndDate" runat="server" ForeColor="Red" ErrorMessage="*" />
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Category">
                        <ItemTemplate>
                            <asp:Label ID="gvlblCategory" runat="server" EnableTheming="false" Text='<%# Eval("Category") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:DropDownList ID="gvddlCategory" runat="server">
                            </asp:DropDownList>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:DropDownList ID="ddlCategory" runat="server">
                            </asp:DropDownList>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="% Update">
                        <ItemTemplate>
                            <asp:Label ID="gvlblUPercent" runat="server" EnableTheming="false" Text='<%# Eval("BPPSPPercent")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="gvtxtUPercent" Width="32px" runat="server" Text='<%# Convert.ToDouble(Eval("BPPSPPercent"))*100 %>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="ReqNBPP" ControlToValidate="gvtxtUPercent" runat="server" ForeColor="Red" ErrorMessage="*" />
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtUPercent" Width="32px" runat="server" />
                            <asp:RequiredFieldValidator ID="ReqEBPP" ValidationGroup="v2" ControlToValidate="txtUPercent" runat="server" ForeColor="Red" ErrorMessage="*" />
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Comments">
                        <ItemTemplate>
                            <asp:Label ID="gvlblComments" runat="server" EnableTheming="false" Text='<%# Eval("Comments") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="gvtxtComments" runat="server" Width="64px" Text='<%# Eval("Comments") %>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="ReqNComm" ControlToValidate="gvtxtComments" runat="server" ForeColor="Red" ErrorMessage="*" />
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtComments" runat="server" Width="64px" />
                            <asp:RequiredFieldValidator ID="ReqEComm" ValidationGroup="v2" ControlToValidate="txtComments" runat="server" ForeColor="Red" ErrorMessage="*" />
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <EditItemTemplate>
                            <asp:ImageButton ID="ButtonUpdate" ImageUrl="~/images/ok-icon.png" runat="server" CommandName="Update"
                                ToolTip="Update" Width="16px" />
                            <asp:ImageButton ID="ButtonCancel" runat="server" ImageUrl="~/images/cancel-icon.png" CommandName="Cancel"
                                ToolTip="Cancel" Width="16px" />
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:ImageButton ID="ButtonEdit" runat="server" ImageUrl="~/images/edit-icon.png" CommandName="Edit" ToolTip="Edit" Width="16px" />
                            <asp:ImageButton ID="ButtonDelete" runat="server" ImageUrl="~/images/delete-icon.png" CommandName="Delete" Width="16px"
                                ToolTip="Delete" OnClientClick='return ConfirmDelete();' />
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:ImageButton ID="ButtonAdd" runat="server" ValidationGroup="v2" Font-Size="Small" CommandName="AddNew" ImageUrl="~/images/Add-button.png" Height="16px" Width="16px" />
                        </FooterTemplate>
                    </asp:TemplateField>
                </Columns>
                <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" VerticalAlign="Top" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" HorizontalAlign="Center" ForeColor="White">
                </HeaderStyle>
                <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                <RowStyle BackColor="White" ForeColor="#330099" Font-Size="Small" VerticalAlign="Top" />
            </asp:GridView>
            </div>
    </div>
</asp:Content>
